import Vue from 'vue';
import Router from 'vue-router';
import Lottery from '@/components/Lottery';
import LotteryResult from '@/components/LotteryResult';
import Wall from "@/components/Wall";
import Trigger from '../view/trigger';

Vue.use(Router);

export default new Router({
	// mode:"history",
	routes: [
		// {
		// 	path: '/',
		// 	redirect: '/wall'
		// },
		{
			path: '/home',
			redirect: '/wall'
		},
		{
			path: '/wall',
			name: '/Wall',
            component: Wall,
            meta:{
                requireAuth:true
            }
		},
		{
			path: '/lottery',
			name: 'Lottery',
			meta:{title:'刷脸签到抽奖',requireAuth:true},
			component: Lottery
		},
		{
			path: '/lotteryResult',
			name: 'LotteryResult',
            component: LotteryResult,
            meta:{
                requireAuth:true
            }
		},
		{
			path: '/trigger',
			name: 'Trigger',
			component: Trigger
		},
		{
            path: '/',
            redirect: '/dashboard'
        },
        {
            path: '/',
            component: resolve => require(['../components/common/Home.vue'], resolve),
            meta: { title: '自述文件' },
            children:[
                {
                    path: '/dashboard',
                    component: resolve => require(['../components/page/Dashboard.vue'], resolve),
                    meta: { title: '系统首页' , requireAuth:true}
                },
                {
                    path: '/icon',
                    component: resolve => require(['../components/page/Icon.vue'], resolve),
                    meta: { title: '自定义图标' , requireAuth:true}
                },
                {
                    path: '/checkInLog',
                    component: resolve => require(['../components/page/CheckInLog.vue'], resolve),
                    meta: { title: '签到日志' , requireAuth:true}
                },
                {
                    path: '/userTable',
                    component: resolve => require(['../components/page/UserTable.vue'], resolve),
                    meta: { title: '人员列表' , requireAuth:true}
                },
                {
                    path: '/departTable',
                    component: resolve => require(['../components/page/DepartTable.vue'], resolve),
                    meta: { title: '部门列表' , requireAuth:true}
                },
                {
                    path: '/lottoryAward',
                    component: resolve => require(['../components/page/LottoryAward.vue'], resolve),
                    meta: { title: '奖品列表' , requireAuth:true}
                },
                {
                    path: '/lottoryPrize',
                    component: resolve => require(['../components/page/LottoryPrize.vue'], resolve),
                    meta: { title: '奖项列表' , requireAuth:true}
                },
                {
                    path: '/lottorySet',
                    component: resolve => require(['../components/page/LottorySet.vue'], resolve),
                    meta: { title: '中奖记录' , requireAuth:true}
                },
                // {
                //     path: '/tabs',
                //     component: resolve => require(['../components/page/Tabs.vue'], resolve),
                //     meta: { title: 'tab选项卡' }
                // },
                {
                    path: '/form',
                    component: resolve => require(['../components/page/BaseForm.vue'], resolve),
                    meta: { title: '基本表单' }
                },
                {
                    // 富文本编辑器组件
                    path: '/editor',
                    component: resolve => require(['../components/page/VueEditor.vue'], resolve),
                    meta: { title: '富文本编辑器' }
                },
                {
                    // 图片上传组件
                    path: '/upload',
                    component: resolve => require(['../components/page/Upload.vue'], resolve),
                    meta: { title: '文件上传' }   
                },
                {
                    // 拖拽列表组件
                    path: '/drag',
                    component: resolve => require(['../components/page/DragList.vue'], resolve),
                    meta: { title: '拖拽列表' }
                },
                {
                    // 拖拽Dialog组件
                    path: '/dialog',
                    component: resolve => require(['../components/page/DragDialog.vue'], resolve),
                    meta: { title: '拖拽弹框' }
                },
                {
                    // 权限页面
                    path: '/permission',
                    component: resolve => require(['../components/page/Permission.vue'], resolve),
                    meta: { title: '权限测试', permission: true }
                },
                {
                    path: '/404',
                    component: resolve => require(['../components/page/404.vue'], resolve),
                    meta: { title: '404' }
                },
                {
                    path: '/403',
                    component: resolve => require(['../components/page/403.vue'], resolve),
                    meta: { title: '403' }
                }
            ]
        },
        {
            path: '/login',
            component: resolve => require(['../components/page/Login.vue'], resolve)
        },
        {
            path: '*',
            redirect: '/404'
        }
	]
});
